\(\int \sqrt {\cos (c+d x)} (A+C \sec ^2(c+d x)) \, dx\) [1079]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (warning: unable to verify)
   Maple [B] (verified)
   Fricas [C] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 44 \[ \int \sqrt {\cos (c+d x)} \left (A+C \sec ^2(c+d x)\right ) \, dx=\frac {2 (A-C) E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d}+\frac {2 C \sin (c+d x)}{d \sqrt {\cos (c+d x)}} \]

[Out]

2*(A-C)*(cos(1/2*d*x+1/2*c)^2)^(1/2)/cos(1/2*d*x+1/2*c)*EllipticE(sin(1/2*d*x+1/2*c),2^(1/2))/d+2*C*sin(d*x+c)
/d/cos(d*x+c)^(1/2)

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 44, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {4151, 3091, 2719} \[ \int \sqrt {\cos (c+d x)} \left (A+C \sec ^2(c+d x)\right ) \, dx=\frac {2 (A-C) E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d}+\frac {2 C \sin (c+d x)}{d \sqrt {\cos (c+d x)}} \]

[In]

Int[Sqrt[Cos[c + d*x]]*(A + C*Sec[c + d*x]^2),x]

[Out]

(2*(A - C)*EllipticE[(c + d*x)/2, 2])/d + (2*C*Sin[c + d*x])/(d*Sqrt[Cos[c + d*x]])

Rule 2719

Int[Sqrt[sin[(c_.) + (d_.)*(x_)]], x_Symbol] :> Simp[(2/d)*EllipticE[(1/2)*(c - Pi/2 + d*x), 2], x] /; FreeQ[{
c, d}, x]

Rule 3091

Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((A_) + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[A*Cos[e +
 f*x]*((b*Sin[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Dist[(A*(m + 2) + C*(m + 1))/(b^2*(m + 1)), Int[(b*Sin[e
+ f*x])^(m + 2), x], x] /; FreeQ[{b, e, f, A, C}, x] && LtQ[m, -1]

Rule 4151

Int[(cos[(e_.) + (f_.)*(x_)]*(b_.))^(m_)*((A_.) + (C_.)*sec[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[b^2, Int
[(b*Cos[e + f*x])^(m - 2)*(C + A*Cos[e + f*x]^2), x], x] /; FreeQ[{b, e, f, A, C, m}, x] &&  !IntegerQ[m]

Rubi steps \begin{align*} \text {integral}& = \int \frac {C+A \cos ^2(c+d x)}{\cos ^{\frac {3}{2}}(c+d x)} \, dx \\ & = \frac {2 C \sin (c+d x)}{d \sqrt {\cos (c+d x)}}-(-A+C) \int \sqrt {\cos (c+d x)} \, dx \\ & = \frac {2 (A-C) E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d}+\frac {2 C \sin (c+d x)}{d \sqrt {\cos (c+d x)}} \\ \end{align*}

Mathematica [C] (warning: unable to verify)

Result contains higher order function than in optimal. Order 5 vs. order 4 in optimal.

Time = 4.49 (sec) , antiderivative size = 192, normalized size of antiderivative = 4.36 \[ \int \sqrt {\cos (c+d x)} \left (A+C \sec ^2(c+d x)\right ) \, dx=\frac {\cos ^{\frac {3}{2}}(c+d x) \left (A+C \sec ^2(c+d x)\right ) \left (-2 (A-C) \, _2F_1\left (-\frac {1}{2},-\frac {1}{4};\frac {3}{4};\cos ^2(d x+\arctan (\tan (c)))\right ) \sec (c) \sin (d x+\arctan (\tan (c)))+\csc (c) \left (3 (A-C) \cos (c-d x-\arctan (\tan (c))) \sec (c)+(A-C) \cos (c+d x+\arctan (\tan (c))) \sec (c)-2 ((A-2 C) \cos (d x)+A \cos (2 c+d x)) \sqrt {\sec ^2(c)}\right ) \sqrt {\sin ^2(d x+\arctan (\tan (c)))}\right )}{d (A+2 C+A \cos (2 (c+d x))) \sqrt {\sec ^2(c)} \sqrt {\sin ^2(d x+\arctan (\tan (c)))}} \]

[In]

Integrate[Sqrt[Cos[c + d*x]]*(A + C*Sec[c + d*x]^2),x]

[Out]

(Cos[c + d*x]^(3/2)*(A + C*Sec[c + d*x]^2)*(-2*(A - C)*HypergeometricPFQ[{-1/2, -1/4}, {3/4}, Cos[d*x + ArcTan
[Tan[c]]]^2]*Sec[c]*Sin[d*x + ArcTan[Tan[c]]] + Csc[c]*(3*(A - C)*Cos[c - d*x - ArcTan[Tan[c]]]*Sec[c] + (A -
C)*Cos[c + d*x + ArcTan[Tan[c]]]*Sec[c] - 2*((A - 2*C)*Cos[d*x] + A*Cos[2*c + d*x])*Sqrt[Sec[c]^2])*Sqrt[Sin[d
*x + ArcTan[Tan[c]]]^2]))/(d*(A + 2*C + A*Cos[2*(c + d*x)])*Sqrt[Sec[c]^2]*Sqrt[Sin[d*x + ArcTan[Tan[c]]]^2])

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(148\) vs. \(2(68)=136\).

Time = 1.39 (sec) , antiderivative size = 149, normalized size of antiderivative = 3.39

method result size
default \(\frac {2 A \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, \operatorname {EllipticE}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )+4 C \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-2 C \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {2 \sin \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, \operatorname {EllipticE}\left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )}{\sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {2 \cos \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1}\, d}\) \(149\)

[In]

int(cos(d*x+c)^(1/2)*(A+C*sec(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

2*(A*(sin(1/2*d*x+1/2*c)^2)^(1/2)*(2*sin(1/2*d*x+1/2*c)^2-1)^(1/2)*EllipticE(cos(1/2*d*x+1/2*c),2^(1/2))+2*C*c
os(1/2*d*x+1/2*c)*sin(1/2*d*x+1/2*c)^2-C*(sin(1/2*d*x+1/2*c)^2)^(1/2)*(2*sin(1/2*d*x+1/2*c)^2-1)^(1/2)*Ellipti
cE(cos(1/2*d*x+1/2*c),2^(1/2)))/sin(1/2*d*x+1/2*c)/(2*cos(1/2*d*x+1/2*c)^2-1)^(1/2)/d

Fricas [C] (verification not implemented)

Result contains higher order function than in optimal. Order 9 vs. order 4.

Time = 0.10 (sec) , antiderivative size = 106, normalized size of antiderivative = 2.41 \[ \int \sqrt {\cos (c+d x)} \left (A+C \sec ^2(c+d x)\right ) \, dx=\frac {\sqrt {2} {\left (i \, A - i \, C\right )} \cos \left (d x + c\right ) {\rm weierstrassZeta}\left (-4, 0, {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) + i \, \sin \left (d x + c\right )\right )\right ) + \sqrt {2} {\left (-i \, A + i \, C\right )} \cos \left (d x + c\right ) {\rm weierstrassZeta}\left (-4, 0, {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) - i \, \sin \left (d x + c\right )\right )\right ) + 2 \, C \sqrt {\cos \left (d x + c\right )} \sin \left (d x + c\right )}{d \cos \left (d x + c\right )} \]

[In]

integrate(cos(d*x+c)^(1/2)*(A+C*sec(d*x+c)^2),x, algorithm="fricas")

[Out]

(sqrt(2)*(I*A - I*C)*cos(d*x + c)*weierstrassZeta(-4, 0, weierstrassPInverse(-4, 0, cos(d*x + c) + I*sin(d*x +
 c))) + sqrt(2)*(-I*A + I*C)*cos(d*x + c)*weierstrassZeta(-4, 0, weierstrassPInverse(-4, 0, cos(d*x + c) - I*s
in(d*x + c))) + 2*C*sqrt(cos(d*x + c))*sin(d*x + c))/(d*cos(d*x + c))

Sympy [F]

\[ \int \sqrt {\cos (c+d x)} \left (A+C \sec ^2(c+d x)\right ) \, dx=\int \left (A + C \sec ^{2}{\left (c + d x \right )}\right ) \sqrt {\cos {\left (c + d x \right )}}\, dx \]

[In]

integrate(cos(d*x+c)**(1/2)*(A+C*sec(d*x+c)**2),x)

[Out]

Integral((A + C*sec(c + d*x)**2)*sqrt(cos(c + d*x)), x)

Maxima [F]

\[ \int \sqrt {\cos (c+d x)} \left (A+C \sec ^2(c+d x)\right ) \, dx=\int { {\left (C \sec \left (d x + c\right )^{2} + A\right )} \sqrt {\cos \left (d x + c\right )} \,d x } \]

[In]

integrate(cos(d*x+c)^(1/2)*(A+C*sec(d*x+c)^2),x, algorithm="maxima")

[Out]

integrate((C*sec(d*x + c)^2 + A)*sqrt(cos(d*x + c)), x)

Giac [F]

\[ \int \sqrt {\cos (c+d x)} \left (A+C \sec ^2(c+d x)\right ) \, dx=\int { {\left (C \sec \left (d x + c\right )^{2} + A\right )} \sqrt {\cos \left (d x + c\right )} \,d x } \]

[In]

integrate(cos(d*x+c)^(1/2)*(A+C*sec(d*x+c)^2),x, algorithm="giac")

[Out]

integrate((C*sec(d*x + c)^2 + A)*sqrt(cos(d*x + c)), x)

Mupad [B] (verification not implemented)

Time = 17.78 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.36 \[ \int \sqrt {\cos (c+d x)} \left (A+C \sec ^2(c+d x)\right ) \, dx=\frac {2\,A\,\mathrm {E}\left (\frac {c}{2}+\frac {d\,x}{2}\middle |2\right )}{d}+\frac {2\,C\,\sin \left (c+d\,x\right )\,{{}}_2{\mathrm {F}}_1\left (-\frac {1}{4},\frac {1}{2};\ \frac {3}{4};\ {\cos \left (c+d\,x\right )}^2\right )}{d\,\sqrt {\cos \left (c+d\,x\right )}\,\sqrt {{\sin \left (c+d\,x\right )}^2}} \]

[In]

int(cos(c + d*x)^(1/2)*(A + C/cos(c + d*x)^2),x)

[Out]

(2*A*ellipticE(c/2 + (d*x)/2, 2))/d + (2*C*sin(c + d*x)*hypergeom([-1/4, 1/2], 3/4, cos(c + d*x)^2))/(d*cos(c
+ d*x)^(1/2)*(sin(c + d*x)^2)^(1/2))